package cn.micai.shiro.chapter6.service;

import cn.micai.shiro.chapter6.dao.RoleDao;
import cn.micai.shiro.chapter6.dao.RoleDaoImpl;
import cn.micai.shiro.chapter6.entity.Role;

/**
 * @author zhaoxinguo on 2017/8/16.
 */
public class RoleServiceImpl implements RoleService {

    private RoleDao roleDao = new RoleDaoImpl();

    public Role createRole(Role role) {
        return roleDao.createRole(role);
    }

    public void deleteRole(Long roleId) {
        roleDao.deleteRole(roleId);
    }

    //添加角色-权限之间关系
    public void correlationPermissions(Long roleId, Long... permissionIds) {
        roleDao.correlationPermissions(roleId,permissionIds);
    }

    //移除角色-权限之间关系
    public void uncorrelationPermissions(Long roleId, Long... permissionIds) {
        roleDao.uncorrelationPermissions(roleId,permissionIds);
    }

}
